/*
 * CS_EXCEPTION_MESSAGE.cpp
 *
 *  Created on: 2013. 8. 28.
 *      Author: the2
 */

#include "connection.h"

#include "../../NResource/Static.h"

namespace ProjectZ { namespace NCommand { namespace NConnection {


void CS_EXCEPTION_MESSAGE::OnExecute( User * pUser, ::Network::Packet *pPacket )
{
	PREPARE_PACKET;

	int16_t exception_ack;
	*pPacket >> exception_ack;

	NResource::ExceptionMessage::Flyweight * pFly = NResource::Static::Instance().GetExceptionMessage()->GetFly(exception_ack);
	if (NULL == pFly)
	{
		pFly = NResource::Static::Instance().GetExceptionMessage()->GetFly(-51);
		::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
		pAck->MsgCat("%2d%c%s", ACK_OK, pFly->_ISFORCEKILL, pFly->_MESSAGE.c_str());
		pAck->MakePacket(CMD_SC_EXCEPTION_MESSAGE);
		pUser->Send(pAck);
		return;
	}

	::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
	pAck->MsgCat("%2d%c%s", ACK_OK, pFly->_ISFORCEKILL, pFly->_MESSAGE.c_str());
	pAck->MakePacket(CMD_SC_EXCEPTION_MESSAGE);
	pUser->Send(pAck);
}


} /*NWorld*/ } /*NCommand*/ } /*ProjectZ*/

